﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Text;

namespace Meraz.Web.Views.Helpers
{
    public static class PagerHelper
    {
        public static string Pager(this HtmlHelper html, int pageIndex, int pageSize, int records)
        {
            return Pager(pageIndex, pageSize, records);
        }
        public static string Pager(int pageIndex, int pageSize, int records)
        {
            int total = records / pageSize;
            if (records % pageSize > 0)
                total += 1;
            StringBuilder builder = new StringBuilder();
            builder.Append("<ul class='pager'>");
            for (int i = 0; i < total; )
            {
                builder.AppendFormat("<li>{0}</li>", ++i);
            }
            builder.Append("</ul>");
            return builder.ToString();
        }
    }
}